<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="text" encoding="iso-8859-1" />

<xsl:template match="/">
      <xsl:variable name="uaj" select="//PARAMETRES/UAJ"/>
      <xsl:variable name="annee" select="//PARAMETRES/ANNEE_SCOLAIRE"/>
      
      <!-- DISISIONS -->
      
      <xsl:for-each select="//DIVISIONS/DIVISION">
INSERT INTO uni_structure(baseid, libelle, id_siecle, type_structure) 
VALUES(1,
          '<xsl:value-of select="LIBELLE_LONG" />',
         '<xsl:value-of select="@CODE_STRUCTURE" />',
         'CL');$$
      </xsl:for-each>
      
      <xsl:for-each select="//GROUPES/GROUPE">
INSERT INTO uni_structure(baseid, libelle, id_siecle, type_structure)
VALUES(1,
       '<xsl:value-of select="LIBELLE_LONG" />',
       '<xsl:value-of select="@CODE_STRUCTURE" />',   
       'GP');$$
      </xsl:for-each>
      
      <!-- MEFS APPARTENANCES -->
      <!--
          <xsl:variable name="code_structure" select="@CODE_STRUCTURE"/>
          <xsl:for-each select="./MEFS_APPARTENANCE/MEF_APPARTENANCE">
INSERT INTO sco_s_div(g_ea_cod,s_dv_cod, s_mf_cod_eta)
VALUES('<xsl:value-of select="$uaj" />',
       '<xsl:value-of select="$code_structure" />',
       '<xsl:value-of select="CODE_MEF" />'
);      
          </xsl:for-each>
      </xsl:for-each>
      -->
      
      <!-- MATIERES -->
      <!--
      <xsl:for-each select="//GROUPES/GROUPE">
INSERT INTO s_str(s_uaj,s_ann,s_sr_id,s_sr_lib_lon,s_sr_rne,s_sr_typ) 
VALUES('<xsl:value-of select="$uaj" />',<xsl:value-of select="$annee" />,
         '<xsl:value-of select="@CODE_STRUCTURE" />',
         '<xsl:value-of select="LIBELLE_LONG" />',
         '<xsl:value-of select="CODE_RNE" />','G');
        -->
      <!-- MEFS APPARTENANCES -->
      <!--
          <xsl:variable name="code_structure" select="@CODE_STRUCTURE"/>
          <xsl:for-each select="./MEFS_APPARTENANCE/MEF_APPARTENANCE">
INSERT INTO s_str_mef(s_uaj,s_ann, s_sr_id, s_mf_cod)
VALUES('<xsl:value-of select="$uaj" />',<xsl:value-of select="$annee" />,
       '<xsl:value-of select="$code_structure" />',
       '<xsl:value-of select="CODE_MEF" />'
);      
          </xsl:for-each>
      -->
      
      <!-- DIVISIONS APPARTENANCES -->
      <!--
        <xsl:for-each select="./DIVISIONS_APPARTENANCE/DIVISION_APPARTENANCE">
INSERT INTO s_str_grp(s_uaj,s_ann,s_sr_id,s_sr_id_par)     
VALUES('<xsl:value-of select="$uaj" />',<xsl:value-of select="$annee" />,
       '<xsl:value-of select="$code_structure" />',
       '<xsl:value-of select="CODE_STRUCTURE" />'
);   
        </xsl:for-each>
      
      </xsl:for-each>-->
      
 </xsl:template>

</xsl:stylesheet>